<template>
  <div>
    <Table :cols="cols"
    :loading="queryLoading"
    :data="list"
    >
    <template v-slot:level="{row:{level}}">
         <el-tag :type="colors[level]">
            {{levels[level]}}级
         </el-tag>
    </template>
    </Table>      
  </div>
</template>

<script>
import Table from "@/components/Table.vue";
import {getRightsList} from '../../../api/rights'
export default {
  components: { Table },
  name:'rightsList',
  data() {
    return {
        levels:['一',"二","三"],
        colors:["","success",'warning'],
      cols: [
        {
          title: "序号",
          type: "index",
          width:50
        },
        {
          title: "权限名称",
          name: "authName",
        },
        {
          title: "路径",
          name: "path",
        },
        {
          title: "权限管理",
          slot: "level",
        },
       
      ],
    };
  },
  created(){
    this.getRights()
  },
  methods:{
    async getRights(){
        try {
            this.queryLoading=true
            this.list=await  getRightsList()
        } catch (error) {
            console.log(error)
        }
        this.queryLoading=false
    }
  }
};
</script>

<style lang="scss" scoped>
</style>